package com.zhengqiangblog.blog.web;

import java.util.List;

import org.apache.log4j.Logger;

import com.zhengqiangblog.blog.model.HotTag;
import com.zhengqiangblog.blog.service.ArticleTagService;
import com.zhengqiangblog.blog.service.SideBarService;
import com.zhengqiangblog.core.ApplicationContext;
import com.zhengqiangblog.core.Model;

public class TagsAction {

	private static final Logger logger = Logger.getLogger(TagsAction.class);

	private SideBarService sideBarService = ApplicationContext.get(SideBarService.class);
	private ArticleTagService articleTagService = ApplicationContext.get(ArticleTagService.class);

	public TagsAction() {
		logger.info("TagsAction initializing...");
	}

	public String execute(Model model) throws Exception {
		List<HotTag> tags = articleTagService.getHotTags(50);
		model.addAttribute("tags", tags);
		sideBarService.initialize(model);
		return "TAGS";
	}

}
